﻿namespace LiSAClient.WpfClient.Resources.Extensions
{
    using System;

    public static class NullOrEmptyExtensions
    {
        public static bool NullOrEmpty(this DateTime val)
        {
            if (val == null || val == new DateTime(0))
            {
                return true;
            }

            return false;
        }

        public static bool NullOrEmpty(this Guid val)
        {
            if (val == null || val == Guid.Empty)
            {
                return true;
            }

            return false;
        }

        public static bool NullOrEmpty(this Guid? val)
        {
            if (val == null || !val.HasValue || val.Value == Guid.Empty)
            {
                return true;
            }

            return false;
        }


        public static bool NullOrEmpty(this DateTime? val)
        {
            if (val == null || !val.HasValue || val.Value == new DateTime(0))
            {
                return true;
            }

            return false;
        }

        public static bool NullOrEmpty(this TimeSpan val)
        {
            if (val == null || val == new TimeSpan(0))
            {
                return true;
            }

            return false;
        }

        public static bool NullOrEmpty(this TimeSpan? val)
        {
            if (val == null || !val.HasValue || val.Value == new TimeSpan(0))
            {
                return true;
            }

            return false;
        }
    }
}

